package rs.udd.web.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class LoginController {

	private static final Logger LOGGER = LogManager.getLogger(LoginController.class);

	@RequestMapping(value = "/login", method = RequestMethod.GET)
	public String login() {
		LOGGER.info("LoginController.login()");
		return "login";
	}

	@RequestMapping(value = "/login/failed", method = RequestMethod.GET)
	public String loginFailed(Model model) {
		LOGGER.info("LoginController.loginError()");
		model.addAttribute("error", "true");
		return "login";
	}

	@RequestMapping(value = "/logout", method = RequestMethod.GET)
	public String logout() {
		LOGGER.info("LoginController.logout()");
		return "login";
	}

}
